<?php session_start();
	include('../controller/functions.php');
	User::connection();

$userArr	= array('admin');
	if(!in_array($_SESSION['user'],$userArr)) {
	User::validSession();

}
if ($_GET['q'] == 'logout') 
{
	User::user_logout();
	print '		
			<script type="text/javascript">		
			window.location = "../login_r.php";
			</script>
			';

}


$strRootpath= "../../";


function FileListTable($pstrFilePath,$pstrFileTypeNeeded,$pstrDataRowParameters, $pstrDataColumnParameters)
{
	$pstrFilePath = "upload";
    $dh = @opendir($pstrFilePath); 
    $strTemp="";
    $intCounter =1;
       while (false !== ($file = @readdir($dh))) { 
	 if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
	/*	 $strTemp .= "$file ";*/

          if (!is_dir("$pstrFilePath/$file")) { 
//Truncate the file extension and capitalize the first letter 
	//	if (stristr($file, $pstrFileTypeNeeded)==TRUE)
		{
			$links = "../images/unchecked.gif";
		$strTemp.=  "<TR " . $pstrDataRowParameters . ">";
		$strTemp.=  "<TD " . $pstrDataColumnParameters . ">" . $intCounter . "</TD>";
		$strTemp.=  "<TD " . $pstrDataColumnParameters . ">" ;
		$strTemp.= $file. "</TD>";
		$strTemp.=  "<TD " . $pstrDataColumnParameters . "><A HREF =\"javaScript:DeleteFile('" . $file . "','File')\" > Delete </TD>" ;

		$strTemp.= "</TR>";
		$intCounter=1 + $intCounter;
		}
   } 
   } 

return $strTemp;

}

if (!isset($_REQUEST["txtFile"]))
{
	$strFileName="";
}
else
{
	$strFileName= QuerySafeString($_REQUEST["txtFile"]);
}



$strTable = FileListTable(ImageUploadPath,"","","" );
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="../images/fav.ico">
<link rel="icon" type="image/gif" href="../images/fav.ico">
<title>CMS Gallery</title>

	<link rel="stylesheet" href="../css/style2.css" type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="../css/front.css" type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="../css/general.css" type="text/css" charset="utf-8" />
</head>
<body>
<!-- For the f**kn LOgin-->


<div id="page">
<div id="wrapper">
        		   <div class="header_top" id="header_top"> </div>
     </div>
               <div class="header2"></div> 
	<div class="header"><!--open logo --></div><!--end header -->
	<!-- close logo-->
<!-- hide the client inquiries php-->
    <?php
    echo '<div id="nav">';
    echo '<div class="underlinemenu">';
	include('menu_view.php');
	echo '</div>';
    echo '</div>';
	?>
    <div id="header_in"> <!--open header -->
  <p> </p>
    
    <table width="100%" height="56">
     <tr>
       <td width="317" align="left" class="date"> 
        <? User::oras(); ?>
        </td>
            
       <td width="388" align="right"><? User::showPic(); ?></td>
       <td width="279">&nbsp;&nbsp;<? User::showUser(); ?>        </td>
       </tr>
   </table>
     
  
    </div>
    <div id="ex">
    </div>
    
      <p> </p>
       <div id="body"> <!--open body -->
  <div id="sidebar"> 
      <!--  <div id="chef_ind"> open chef --><!--close welcome-->

<? echo '<p class="more">';
echo '';
 
   require('sideBar.php');
    
echo'</p>';
?>

        <!--</div> -->
        </div>
     <div id="content"> 
      <div class="desriptionHeader"> <!--open right-->
      <div id="container">
    
         <div class="post3"><h1>Website Management</h1> </div>
      
            <div class="desriptionHeader"> <!--open right-->
       <div class="postbg"><!--open booking -->
<div align="center" class="mainbox">
           <font color="#FF0000"><strong>*Note: You can only upload ONE picture at a time.</strong></font>
     			<?php


print "</HEAD><BODY>";
print "<TABLE border=0>";
print "<TR><TD width=25% VALIGN=TOP >";

print "</TD></TR>";

print "<TR><TD>";

 print "<FORM action=\"\" method=POST id=frmForm name=frmForm>";
print "<table bgcolor='#EBF9B4'; border='2' cellspacing='0' cellpadding='4' bordercolor='#61770F' width='90%'>"; 
print "<center>";
print  "<p class='cel' id='cel' title='$con\n of \n Home $cby'>";
print "</p>";
?>


<TR>
		<TH>No.</TH>
		<TH>File Name</TH>
		<TH>Delete</TH>
	</TR>
<?php
 
	print $strTable;
?>	
</TABLE>
	<TR>
	<TD><INPUT  class='btn' type="button" value="Add" id=bbtn name=cmdAdd  onclick = "AddFile();">


</TD>
</TR>
</TABLE>


<p>
  <INPUT type="hidden" id=txtAction name=txtAction>
  <INPUT type="hidden" id=txtFile name=txtFile>
  <INPUT type="hidden" id=txtType name=txtType>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</FORM>
<?php
print "</TD></TR>";
print "</center>";
print "</TABLE>";
?>
</div>
   <SCRIPT LANGUAGE=javascript>
<!--

function DeleteFile(ID,Type) { 
	if (confirm ("This will delete this?")) {
		document.frmForm.txtFile.value=ID;
		document.frmForm.txtAction.value='DEL';
		document.frmForm.action='upload/deleteImage.php';
		document.frmForm.submit();
	}   
}
function AddFile() {
	location.replace('uploadImage.php');
	}

//-->
</SCRIPT>

	  </div><!--close booking -->
   </div><!--close desc -->
    	</div> <!--close right-->
      <div class="clear">&nbsp;</div>
      </div>
  </div><!--close booking -->
   </div><!--close desc -->
   
          
 
 <!-- footer-->
 <?php 
	  echo '<div id="footer">';
     include('footer_view.php');
      echo '</div>';
	  ?>

    </div><!-- close body-->
</div><!-- close page-->


</body>
</html>

